package org.starsource.forum.client.domain;

import org.starsource.forum.client.util.Assertion;
import com.google.gwt.user.client.rpc.IsSerializable;

public class ResourceObject implements IsSerializable {

	private int id;
	
	private MessageObject message;
	
	private String url;
	
	private String thumbUrl;
	
	private int width;
	
	private int height;

	public ResourceObject() {
		
	}
	
	public ResourceObject(MessageObject message, String url, String thumbUrl, int width, int height) {
		this.message = message;
		this.url = url;
		this.thumbUrl = thumbUrl;
		this.width = width;
		this.height = height;
	}
	
	public ResourceObject(int id, MessageObject message, String url, String thumbUrl, int width, int height) {
		this.id = id;
		this.message = message;
		this.url = url;
		this.thumbUrl = thumbUrl;
		this.width = width;
		this.height = height;
	}
	
	public boolean equals(Object obj) {
		try {
			ResourceObject object = (ResourceObject)obj;
			if (this.id != object.id) return false;
			
			if (!Assertion.isEqual(this.message, object.message)) return false;
			
			if (!Assertion.isEqual(this.url, object.url)) return false;

			if (!Assertion.isEqual(this.thumbUrl, object.thumbUrl)) {
				return false;
			}

			if (this.width != object.width) {
				return false;
			}

			if (this.height != object.height) {
				return false;
			}

			return true;
		} catch (Exception e) {
			return false;
		}
	}
	
	public int getId() {
		return this.id;
	}
	
	public void setId(int id) {
		this.id = id;
	}
	
	public MessageObject getMessageObject() {
		return this.message;
	}
	
	public void setMessageObject(MessageObject message) {
		this.message = message;
	}
	
	public String getUrl() {
		return this.url;
	}
	
	public void setUrl(String url) {
		this.url = url;
	}

	public String getThumbUrl() {
		return this.thumbUrl;
	}
	public void setThumbUrl(String thumbUrl) {
		this.thumbUrl = thumbUrl;
	}
	
	public int getWidth() {
		return this.width;
	}
	
	public void setWidth(int width) {
		this.width = width;
	}
	
	public int getHeight() {
		return this.height;
	}
	
	public void setHeight(int height) {
		this.height = height;
	}
}
